package cn.tedu.m3;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Scanner;

@Component
public class producer {
    @Autowired
    private AmqpTemplate t;

    public void send(){
        while (true){
            System.out.print("\n请输入消息:");//为避免重行折行
            String str = new Scanner(System.in).nextLine();
            t.convertAndSend("logs","",str);//群发
        }
    }
}
